using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.IO;
using QlyKinhDoanh.Utility;

namespace prjQlyKinhDoanh
{
    public partial class frmReportByAreaViewer : Form
    {
        string _sTuNgay, _sDenNgay;
        int _iDiaBanId;
        public frmReportByAreaViewer()
        {
            InitializeComponent();
        }

        public frmReportByAreaViewer(string strTuNgay, string strDenNgay, int iDiaBanId)
        {
            InitializeComponent();
            _sTuNgay = strTuNgay;
            _sDenNgay = strDenNgay;
            _iDiaBanId = iDiaBanId;
        }

        private void frmReportByAreaViewer_Load(object sender, EventArgs e)
        {
            string ReportFile = Declare.AppPath + "Reports\\rptReportByArea.rpt";
            //SqlParameter[] para = new SqlParameter[4];
            //para[0] = new SqlParameter("@iDiaBanXa", SqlDbType.Int,4);
            //para[0].Value = _iDiaBanId;
            //para[1] = new SqlParameter("@TuNgay", SqlDbType.VarChar,10);
            //para[1].Value = _sTuNgay;
            //para[2] = new SqlParameter("@DenNgay", SqlDbType.VarChar,10);
            //para[2].Value = _sDenNgay;
            //para[3] = new SqlParameter("@iLoaiHS", SqlDbType.Int, 4);
            //para[3].Value = 0;
            //Common.LoadReportFile(ReportFile, this.crystalReportViewer1, "HL_HO_SO_CMND_ReportByCondition", para, "HL_HO_SO_CMND");

            string[] paraName = new string[5];
            paraName[0] = "@iDiaBanXa";
            paraName[1] = "@TuNgay";
            paraName[2] = "@DenNgay";
            paraName[3] = "@iLoaiHS";
            paraName[4] = "@iDoiTuong";

            object[] paraValue = new object[5];
            paraValue[0] = Common.IntValue(_iDiaBanId.ToString());
            paraValue[1] = _sTuNgay;
            paraValue[2] = _sDenNgay;
            paraValue[3] = 0;
            paraValue[4] = 0;
            ReportUtility.LoadReportFile(ReportFile, crystalReportViewer1, paraName, paraValue);

        }
    }
}